package cn.car.domains.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum PlateColorEnum {

    UNDEFINED(Integer.MIN_VALUE, "找不到的类型"),
    BLUE(0, "蓝牌"),
    YELLOW(1, "黄牌"),
    WHITE(2, "白牌"),
    BLACK(3, "黑牌"),
    GREEN(4, "新能源绿牌"),
    OTHER(5, "其他"),
    YELLOW_GREEN(6, "新能源绿黄牌"),
    ;
    private final int code;
    private final String desc;

    public static PlateColorEnum codeOf(Integer code) {
        if (code == null) {
            return null;
        }
        for (PlateColorEnum color : values()) {
            if (color.code == code) {
                return color;
            }
        }
        return null;
    }
}
